home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Magazine
/
Online
/
httpproxy
/
src
/
debug.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-08-20
|
3KB
|
99 lines
/*(( "Header" */
/*
* $Id: debug.h,v 1.2 1996/08/20 17:36:43 mshopf Exp mshopf $
*
* (c) 1995-96 Matthias Hopf
*
* Debugging macros.
*
*/
/*
* $Log: debug.h,v $
* Revision 1.2 1996/08/20 17:36:43 mshopf
* added DEBUG_LEVELS description macro.
*
* Revision 1.1 1996/08/11 22:25:15 mshopf
* Initial revision
*
*
*/
/*)) */
#ifndef _DEBUG_H__
#define _DEBUG_H__
/*(( "Debuglevels" */
enum { D_REQUEST, /* request begin/end, Flags */
D_IO, /* verbose input/output */
D_CHECK, /* cache/request checks */
D_SCAN, /* url/request scanning */
D_QUEUE, /* queuing process */
D_MSG, /* output log messages */
D_FILES, /* output cache file names */
D_CACHE, /* cache checks debug output */
D_HASH, /* hash value computation / character substitution */
D_NET, /* networking debug */
D_ALWAYS /* first free Debugbit */
} ;
#ifdef DEBUG
# define DEBUG_LEVELS \
" 1:req request begin/end, Flags 2:i/o verbose input/output\n" \
" 4:chk cache/request checks 8:scn url/request scanning\n" \
" 16:que queuing process 32:msg output log messages\n" \
" 64:fil output cache file names 128:cch cache checks\n" \
"256:has hash value computation / character substitution\n" \
"512:net network module (1024:***) always (not to be specified)\n"
#else
# define DEBUG_LEVELS "Debugging not enabled."
#endif
/*)) */
/*(( "Global Variables" */
#ifdef DEBUG
/* ok, that string is defined multiple times but how cares... */
static const char * DebugNames [] = { "req", "i/o", "chk", "scn", "que", "msg", "fil", "cch", "has", "net", "***" };
extern int DebugLevel;
static int DebugReturnValue; /* needed for dreturn */
#endif
/*)) */
/*(( "debug() Macros" */
#ifdef DEBUG
# define debug(d,x) do { if (DebugLevel & (1<<(d))) { printf ("(%s-%12.12s) ", DebugNames [d], __FUNC__); printf x; } } while (0)
# define debugraw(d,x) do { if (DebugLevel & (1<<(d))) printf x; } while (0)
# define vdebug(d,x,y) do { if (DebugLevel & (1<<(d))) { printf ("(%s-%12.12s) ", DebugNames [d], __FUNC__); vprintf (x, y); } } while (0)
# define vdebugraw(d,x,y) do { if (DebugLevel & (1<<(d))) vprintf (x, y); } while (0)
# define dreturn(d,x) return ( DebugReturnValue = (x), ((DebugLevel & (1<<(d))) ? printf ("(%s-%12.12s) return line %4d --- %d\n", DebugNames [d], __FUNC__, __LINE__, DebugReturnValue) : 0), DebugReturnValue)
#else
# define debug(d,x) ((void) 0)
# define debugraw(d,x) ((void) 0)
# define vdebug(d,x,y) ((void) 0)
# define vdebugraw(d,x,y) ((void) 0)
# define dreturn(d,x) return (x)
#endif
/*)) */
/*(( assert() */
/* own assert() writing assertation to logfile */
#ifndef NDEBUG
void ASSERT (int, const char *, const char *, const char *, int);
# define assert(x) ASSERT ((int)(x), #x, __FILE__, __FUNC__, __LINE__)
#else
# define assert(x) ((void) 0)
#endif
/*)) */
#endif /* _DEBUG_H__ */